<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录页面</title>
    <script src="/js/jquery-3.1.1.js"></script>
</head>
<body>
<h2>登录成功!</h2>
<a href="/pages/ajaxDemo.html?p=1" rel="external">ajax</a>

<hr>
<div id="div1"><p>设置Cookie</p></div>
<div id="div2"><p>获取Cookie</p></div>
<button id="button1">设置Cookie</button>
<button id="button2">获取Cookie</button>
<hr>
<div id="div3"><p>Session值</p></div>
<button id="button3">获取Session</button>
<button id="button4">销毁Session</button>
</body>

<script>
    $(document).ready(function () {
        $("#button1").click(function () {
            $.get("/s/setCookie", function (data, status) {
                console.log(JSON.stringify(data))
                $("#div1").html(JSON.stringify(data))
            });
        });

        $("#button2").click(function () {
            $.get("/s/getCookie", function (data, status) {
                console.log(JSON.stringify(data))
                $("#div2").html(JSON.stringify(data))
            });
        });

        $("#button3").click(function () {
            $.get("/s/getSession", function (data, status) {
                console.log(JSON.stringify(data))
                $("#div3").html(JSON.stringify(data))
            });
        });

        $("#button4").click(function () {
            $.get("/s/destroySession", function (data, status) {
                console.log(JSON.stringify(data))
            });
        });
    });
</script>
</html>
